package com.wmyg.scanninggun.dao;

import com.wmyg.scanninggun.bean.Bill;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface BillMapper {

    @Insert({"insert into bill(operator,device_id,case_id,creatime,state,factory_id,factory_name) " +
            "value(#{operator},#{deviceId},#{caseId},#{creatime},#{state},#{factoryId},#{factoryName})"})
    @Options(useGeneratedKeys = true, keyProperty = "billId", keyColumn = "bill_id")
    int insert(Bill bill);

    int update(Bill bill);

    @Update({"update bill set state=state|4 where bill_id=#{billId}"})
    int uploaded(Bill bill);

    int batchInsertBox(Bill bill);

//    Bill selectById(int id);

    //List<Bill> selectByNewBill(Bill bill);

    List<Bill> selectAllByNewBill(Bill bill);

    //List<Bill> selectInvaildBillsByDeviceId(String deviceId);

    List<Bill> selectNotUploadedBills();

    int selectValidCount(String deviceId, String startTime);

    int selectInvalidCount(String deviceId, String startTime);
}
